import { RouteRecordRaw } from 'vue-router'
import layout from '../layout/index.vue'

const routes: Array<RouteRecordRaw> = [
  // 首页
  {
    path: '/',
    redirect: '/home',
    meta: {
      title: '首页',
      icon: 'House',
    },
  },
  {
    path: '/',
    component: layout,
    meta: {
      exclude: true, // 排除在侧边菜单中的渲染
    },
    children: [
      {
        path: '/home',
        name: 'home',
        component: () => import('../views/home/index.vue'),
        meta: {
          title: '首页',
          icon: 'odometer',
        },
      },
      {
        path: '/role',
        name: 'index',
        component: () => import('../views/role/index.vue'),
        meta: {
          title: '权限详情',
          icon: 'UserFilled',
        },
      },
    ]
    },

      // 登录
      {
        path: '/login',
        name: 'login',
        components: {
          default: () => import('../views/login/index.vue'),
        },
        meta: {
          exclude: true, // 排除在侧边菜单中的渲染
        },
      },
      // 注册
      {
        path: '/register',
        name: 'register',
        components: {
          default: () => import('../views/register/index.vue'),
        },
        meta: {
          exclude: true, // 排除在侧边菜单中的渲染
        },
      },
      // 角色权限
      {
        path: '/role',
        component: layout,
        meta: {
          title: '成员管理',
          icon: 'UserFilled',
        },
        children: [
          {
            path: '/role',
            name: 'index',
            component: () => import('../views/role/index.vue'),
            meta: {
              title: '角色管理',
              icon: 'UserFilled',
            },
          },
          {
            path: '/role/admin',
            name: 'admin',
            component: () => import('../views/role/admin.vue'),
            meta: {
              title: '管理员',
              icon: 'UserFilled',
            },
          },
          {
            path: '/role/personal',
            name: 'personal',
            component: () => import('../views/role/personal.vue'),
            meta: {
              title: '个人中心',
              icon: 'UserFilled',
            },
          },
        ],
      },
      // 前台首页
      // {
      //   path: '/page/home',
      //   name: 'page',
      //   components: {
      //     default: () => import('../components/layout/index.vue'),
      //   },
      //   meta: {
      //     exclude: true, // 排除在侧边菜单中的渲染
      //   },
      //   children: [
      //     {
      //       path: '/page/home',
      //       name: 'pageHome',
      //       component: () => import('../views/pages/home/index.vue'),
      //       meta: {
      //         title: '网站首页',
      //         icon: 'odometer',
      //       },
      //     },
      //     {
      //       path: '/page/about',
      //       name: 'pageAbout',
      //       component: () => import('../views/pages/about/index.vue'),
      //       meta: {
      //         title: '关于我们',
      //         icon: 'odometer',
      //       },
      //     },
      //   ],
      // },
      // 商品管理
      {
        path: '/shapping',
        component: layout,
        meta: {
          title: '商品管理',
          icon: 'Shop',
        },
        children: [
          {
            path: '/shapping/furniture',
            name: 'furniture',
            component: () => import('../views/shapping/furniture.vue'),
            meta: {
              title: '家具方面',
              icon: 'Handbag',
            },
          },
          {
            path: '/shapping/stock',
            name: 'stock',
            component: () => import('../views/shapping/stock.vue'),
            meta: {
              title: '进货方面',
              icon: 'Handbag',
            },
          },
          {
            path: '/shapping/overhead',
            name: 'overhead',
            component: () => import('../views/shapping/overhead.vue'),
            meta: {
              title: '流水开销',
              icon: 'Handbag',
            },
          },
        ],
      },

      // 用户管理 
      {
        path: '/user',
        component: layout,
        meta: {
          title: '用户管理',
          icon: 'UserFilled',
        },
        children: [
          {
            path: '/user/controller',
            name: 'controller',
            component: () => import('../views/user/controller.vue'),
            meta: {
              title: '管理者信息',
              icon: 'UserFilled',
            }
          },
          {
            path: '/user/info',
            name: 'info',
            component: () => import('../views/user/info.vue'),
            meta: {
              title: '客户信息',
              icon: 'UserFilled',
            }
          },
        ]
      },
      // 关于订单
      {
        path: '/order',
        component: layout,
        meta: {
          title: '关于订单',
          icon: 'ShoppingCartFull',
        },
        children: [
          {
            path: '/order/state',
            name: 'state',
            component: () => import('../views/order/state.vue'),
            meta: {
              title: '订单列表',
              icon: 'Memo',
            },
          },
          {
            path: '/order/refund',
            name: 'refund',
            component: () => import('../views/order/refund.vue'),
            meta: {
              title: '退款售后',
              icon: 'Memo',
            },
          },
          {
            path: '/order/map',
            name: 'map',
            component: () => import('../views/order/map.vue'),
            meta: {
              title: '地图',
              icon: 'Location',
            },
          },
        ]
      },
      //流水开销
      {
        path: '/finance',
        component: layout,
        meta: {
          title: '财务管理',
          icon: 'WindPower',
        },
        children: [
          {
            path: '/finance/index',
            name: 'finance',
            component: () => import('../views/finance/index.vue'),
            meta: {
              title: '流水开销',
              icon: 'Flag',
            },
          },
        ]
      },
      // 关于我们
      {
        path: '/about',
        component: layout,
        meta: {
          title: '关于我们',
          icon: 'WindPower',
        },
        children: [
          {
            path: '/about/index',
            name: 'about',
            component: () => import('../views/about/index.vue'),
            meta: {
              title: '加盟',
              icon: 'Flag',
            },
          },
        ]
      },
      {
        path: '/:pathMatch(.*)*',
        name: 'NotFound',
        component: () => import('../views/not-found/index.vue'),
        meta: {
          exclude: true, // 排除在侧边菜单中的渲染
        },
      },
    ]

export default routes